package com.yalisanda.edu.controller;

import com.yalisanda.edu.entity.Eduteacher;
import com.yalisanda.edu.entity.vo.TeacherVo;
import com.yalisanda.edu.service.TeacherService;
import org.springframework.web.bind.annotation.*;
import org.ylsdxy.model.response.ResponseResult;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Resource
    private TeacherService teacherService;
    @GetMapping("/findAllTeachers")
    public ResponseResult<List<TeacherVo>> findAllTeachers(){
        List<TeacherVo> allTeachers = teacherService.findAllTeachers();
        return new ResponseResult<>(ResponseResult.SUCCESS,"success",allTeachers);
    }

    //单击头像按钮  查看这个老师的详细信息
    @GetMapping("/findTeacherById/{id}")
    public ResponseResult<Eduteacher> findTeacherById(@PathVariable("id") Integer id){
        Eduteacher teacherById = teacherService.findTeacherById(id);
        return new ResponseResult<>(ResponseResult.SUCCESS,"success",teacherById);
    }
}
